<?php
use Qiniu\Storage\UploadManager;
use Qiniu\Auth;

class Delete{

    public function __construct()
    {

    }

    public static function delete($key){

        $config=require __DIR__.'/config.php';

        $time=date('Y-m-d H:i:s', time());

        $accessKey = $config['accessKey'];
        $secretKey = $config['secretKey'];
        $bucket = $config['bucket'];
        
        $auth = new Auth($accessKey, $secretKey);
        $config = new \Qiniu\Config();
        $bucketManager = new \Qiniu\Storage\BucketManager($auth, $config);
        $err = $bucketManager->delete($bucket, $key);


        if ($err) {


            Log::write("${key}删除失败!${time}");

            var_dump("${key}删除失败!${time}");

        }else{

            Log::write("${key}删除成功!${time}");
            var_dump("${key}删除成功!${time}");
        }
    }
}
